var uploadPic = function () {
    return {
        //main function to initiate the module
        init: function (parameter,jsLang) {
			if(!$.isEmptyObject(parameter)){
				
				for(var i=0; i<parameter.length; i++){					
					(function(j){
						$('#'+parameter[j].btn).on('click', function(){

							art.dialog.open(""+ABS_URL_Theme+"Assets/plugins/ckfinder/upload_bak.html?abs_url=&type=Photo&filetype=pic&box="+parameter[j].box+"&ptype="+parameter[j].ptype+"&field="+parameter[j].field+"",{title: parameter[j].title, width:650,height:400,fixed:true});
							
						});
					})(i);
				}
			}
			
			
			$('.uploadPic_box dl').live('mouseenter',function(){
				$(this).children('.pictool').show();
			});
			$('.uploadPic_box dl').live('mouseleave',function(){
				$(this).children('.pictool').hide();
			});
			
			//删除图片
			$('.pdel').live('click',function(){
				$(this).parent().parent('dl').remove();
			});
			//裁剪图片
			$('.pzoom').live('click',function(){
				var src = $(this).parent('dd').prevAll('dt').children('img').attr('src');
				var pid = src.split('_');
				pid = pid[pid.length-1].split('.');
				pid = pid[0];
				$(this).parent('dd').parent('dl').append('<input type="hidden" id="p_'+pid+'"/>');
				
				art.dialog.open(""+ABS_URL_Theme+"Assets/plugins/jquery-jcrop/index.html?rel_url="+REL_URL+"&pic_url="+src+"&pid="+pid+"&crop_false="+jsLang.crop_false+"&crop_noselect="+jsLang.crop_noselect+"",{title: jsLang.crop_title, width:580,height:420,fixed:true});
			});
			//查看图片
			$('.pshow').live('click',function(){
				window.open($(this).parent('dd').prevAll('dt').children('img').attr('src'));
			});
        }

    };

}();